<?php

/*
 * Database connection file
 * ===============================================
 * Date: March 17th, 2012
 * Created By: Integration Team
 * ===============================================
 */

try 
{
    if (!$link = mysql_connect(DB_Host, DB_User, DB_Password))
            Throw New customException(mysql_error());
    if (!mysql_select_db(Spex_DB_name))
            throw New customException(mysql_error());
} 
catch (Exception $e) 
{
    echo $e->getMessage().$e->getTraceAsString();
    exit(1);
}
function query($query_string){
    //Returns resultset 
    $result = "";
    
    if($query_string == ''){
        return false;
    }
    try 
    {
        if(!$result = mysql_query($query_string))
        {
        throw new customException(mysql_error());
        }
    }
    catch (Exception $e)
    {
     echo $e->getMessage()." ".$e->getTraceAsString()."<br/>".$query_string;
     exit(1);
    }
    return $result;
    
}

?>
